{layout name="public/layout" /}
{include file='yxnavbar'}
<form class="form-horizontal form" action="" id="form1"  method="post" enctype="multipart/form-data">
    <div class="panel panel-default" role="tabpanel" style="">
        <div class="panel-heading">模版消息</div>
        <div class="panel-body" style="">
            {loop $mblist $item}
            <div class="form-group">
                <label class="col-sm-2 col-xs-12 control-label">{$item['name']}</label>
                <div class="col-sm-7 col-xs-12">
                    <div class="input-group">
                        <span class="input-group-addon">总订阅用户数</span>
                        <input type="text" class="form-control"  placeholder="" value="{$item['total']}">
                        <span class="input-group-addon">累计发送</span>
                        <input type="text" class="form-control"  placeholder="" value="{$item['used']}">
                        <span class="input-group-addon">今日发送</span>
                        <input type="text" class="form-control"  placeholder="" value="{$item['today']}">
                        <span class="input-group-addon">可发送</span>
                        <input type="text" class="form-control"  placeholder="" value="{$item['count']}">
                        {if $config['ishexiao']==1}
                        <span class="input-group-addon">已核销</span>
                        <input type="text" class="form-control"  placeholder="" value="{$item['hexiao']}">
                        {/if}
                    </div>
                </div>
                {if !$item['autosend']}
                <div class="col-sm-1">
                    <a class="btn btn-info" href="{php echo createWebUrl('mbxx', array('op'=>'post','template_id'=>$item['template_id']));}">发送</a>
                </div>
                {else}
                <div class="col-sm-1">
                    <div class="btn btn-default">自动</div>
                </div>
                {/if}
            </div>
            {/loop}
        </div>
    </div>
</form>
{if $op == 'post' || $op == 'confirm'}
<form class="form-horizontal form" action="" id="form1"  method="post" enctype="multipart/form-data">
    <div class="panel panel-default" role="tabpanel" style="">
        <div class="panel-heading" style="background-color: #478ec8;color: #ffffff;">发送信息</div>
        <div class="panel-body" style="">
            <div class="form-group">
                <label class="col-sm-2 col-xs-12 control-label" style="font-weight:900">{$mbinfo['name']}</label>
                <div class="col-sm-7 col-xs-12">
                    <div class="input-group">
                        <span class="input-group-addon">总订阅用户数</span>
                        <input type="text" class="form-control"  placeholder="" value="{$mbinfo['total']}">
                        <span class="input-group-addon">累计发送</span>
                        <input type="text" class="form-control"  placeholder="" value="{$mbinfo['used']}">
                        <span class="input-group-addon">今日发送</span>
                        <input type="text" class="form-control"  placeholder="" value="{$mbinfo['today']}">
                        <span class="input-group-addon">可发送</span>
                        <input type="text" class="form-control"  placeholder="" value="{$mbinfo['count']}">
                        {if $config['ishexiao']==1}
                        <span class="input-group-addon">已核销</span>
                        <input type="text" class="form-control"  placeholder="" value="{$item['hexiao']}">
                        {/if}
                    </div>
                </div>
            </div>
            {if $op=='post'}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color: red;">*</span>发送范围</label>
                    <div class="col-sm-5 col-xs-12">
                        {if $config['ishexiao']==1}
                        <label class="radio-inline">
                            <input name="userlimit" value="0" checked="checked" type="radio"> 已核销的不发
                        </label>
                        {/if}
                        <label class="radio-inline">
                            <input name="userlimit" value="1" {if $config['ishexiao']!=1}checked="checked"{/if} type="radio"> 今日未发的所有用户
                        </label>
                        <label class="radio-inline">
                            <input name="userlimit" value="2" type="radio"> 所有订阅用户
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color: red;">*</span>发送用户数</label>
                    <div class="col-sm-8 col-xs-12">
                        <input type="text" class="form-control" maxlength="20" name="sendlimit" placeholder="" value="{$mbinfo['count']}">
                        <span class="help-block">可限制此次发送的用户数，如订阅用户2000个，今日只邀请200人进店，则此处输入200即可</span>
                    </div>
                </div>
                {loop $form $index $item}
                    {if $item['type']=='daterange'}
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">{$item['name']}</label>
                            <div class="col-sm-5 col-xs-12">
                                {php echo view_form_field_daterange($item['key'], array('start'=>date('Y-m-d 00:00:00'),'end'=>date('Y-m-d H:i:s',$theme['endtime'])), true);}
                            </div>
                        </div>
                    {else}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">{$item['name']}</label>
                        <div class="col-sm-8 col-xs-12">
                            <input type="text" class="form-control" maxlength="20" name="{$item['key']}" placeholder="" value="{$item['value']}">
                        </div>
                    </div>
                    {/if}
                {/loop}
            {else}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color: red;">*</span>发送范围</label>
                    <div class="col-sm-5 col-xs-12">
                        {if $config['ishexiao']==1}
                        <label class="radio-inline">
                            <input name="userlimit0" value="0" {if $_P['userlimit']==0}checked="checked"{/if} type="radio" disabled> 已核销的不发
                        </label>
                        {/if}
                        <label class="radio-inline">
                            <input name="userlimit0" value="1" {if $_P['userlimit']==1}checked="checked"{/if} type="radio" disabled> 今日未发的所有用户
                        </label>
                        <label class="radio-inline">
                            <input name="userlimit0" value="2" {if $_P['userlimit']==2}checked="checked"{/if} type="radio" disabled> 所有订阅用户
                        </label>

                        <input type="hidden" name="userlimit" value="{$_P['userlimit']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color: red;">*</span>发送用户数</label>
                    <div class="col-sm-8 col-xs-12">
                        <input type="text" class="form-control" maxlength="20" name="sendlimit" placeholder="" value="{$_P['sendlimit']}" readonly>
                        <span class="help-block">可限制此次发送的用户数，如订阅用户2000个，今日只邀请200人进店，则此处输入200即可</span>
                    </div>
                </div>
                {loop $form $index $item}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">{$item['name']}</label>
                        <div class="col-sm-8 col-xs-12 ">
                            {$item['value']}
                        </div>
                    </div>
                    <input type="hidden" name="{$item['key']}" value="{$item['value']}" />
                {/loop}
            {/if}
        </div>
    </div>
    <div class="form-group" >
        <div class="col-sm-12">
            {if $mbinfo['count']==0}
            <span style="color: red">暂无新的订阅,无法发送</span>
            {else}
            {if $op=='post'}
            <input  name="submit" id="btnConfirm" type="submit" value="立即发送" class="btn btn-primary col-lg-3" style="width:120px;">
            {else}
            <input  name="confirm" id="btnConfirm" type="submit" value="确认发送" class="btn btn-warning col-lg-3" style="width:120px;">
            {/if}
            {/if}
            <input type="hidden" name="__token__" value="{$Request.token}" />
        </div>
    </div>
</form>
{/if}

